import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    user: {
      u_name: '',
      u_account: '',
      u_level: '',
      role_id: ''
    },
  },
  getters: {
    user: (state) => state.user,
  },
  mutations: {
    SET_USER_INFO(state, payload) {
      console.log('store', state, payload);
      state.user.u_name = payload.u_name;
      state.user.u_account = payload.u_account;
      state.user.u_level = payload.u_level;
      state.user.role_id = payload.role_id;
    },
  },
  actions: {},
  modules: {},
});
